import turtle as t
import time


def circles_01():
    pen = t.Pen()
    t.width(2)
    for i in range(8):
        # pen.goto(0,100)
        if i % 2 == 1:
            pen.pencolor('red')
        else:
            pen.pencolor('green')
        pen.circle(100)
        pen.right(45)

    time.sleep(3)


def circles_02(n):
    pen = t.Pen()
    pen.speed(5)
    for i in range(1, n + 1):
        draw_circle(0, 0, 50 * i, pen)


def circles_03(n, pen=None):
    if not pen:
        pen = t.Pen()
        print('pen')
    if n == 0:
        return
    print(n)
    draw_circle(0, 0, n * 50, pen)
    circles_03(n - 1, pen)


def draw_circle(x, y, r, pen=None):
    " 以xy为圆心,r为半径,画圆"
    # goto到圆圈的底端, 然后调用circle()
    if not pen:
        pen = t.Pen()
    pen.up()
    pen.goto(x, y - r)
    pen.down()
    pen.circle(r)


if __name__ == '__main__':
    pen = t.Pen()
    circles_03(5, pen)
    # draw_circle(0,0,100)
